/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.StateVariables.impl;

import EA_Model.IEC61970.Domain.ActivePower;
import EA_Model.IEC61970.Domain.ReactivePower;

import EA_Model.IEC61970.StateVariables.StateVariablesPackage;
import EA_Model.IEC61970.StateVariables.SvInjection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Sv Injection</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.StateVariables.impl.SvInjectionImpl#getPNetInjection <em>PNet Injection</em>}</li>
 *   <li>{@link EA_Model.IEC61970.StateVariables.impl.SvInjectionImpl#getQNetInjection <em>QNet Injection</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SvInjectionImpl extends StateVariableImpl implements SvInjection {
	/**
	 * The cached value of the '{@link #getPNetInjection() <em>PNet Injection</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPNetInjection()
	 * @generated
	 * @ordered
	 */
	protected ActivePower pNetInjection;

	/**
	 * The cached value of the '{@link #getQNetInjection() <em>QNet Injection</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQNetInjection()
	 * @generated
	 * @ordered
	 */
	protected ReactivePower qNetInjection;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SvInjectionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return StateVariablesPackage.Literals.SV_INJECTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower getPNetInjection() {
		if (pNetInjection != null && pNetInjection.eIsProxy()) {
			InternalEObject oldPNetInjection = (InternalEObject)pNetInjection;
			pNetInjection = (ActivePower)eResolveProxy(oldPNetInjection);
			if (pNetInjection != oldPNetInjection) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateVariablesPackage.SV_INJECTION__PNET_INJECTION, oldPNetInjection, pNetInjection));
			}
		}
		return pNetInjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower basicGetPNetInjection() {
		return pNetInjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPNetInjection(ActivePower newPNetInjection) {
		ActivePower oldPNetInjection = pNetInjection;
		pNetInjection = newPNetInjection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, StateVariablesPackage.SV_INJECTION__PNET_INJECTION, oldPNetInjection, pNetInjection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ReactivePower getQNetInjection() {
		if (qNetInjection != null && qNetInjection.eIsProxy()) {
			InternalEObject oldQNetInjection = (InternalEObject)qNetInjection;
			qNetInjection = (ReactivePower)eResolveProxy(oldQNetInjection);
			if (qNetInjection != oldQNetInjection) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateVariablesPackage.SV_INJECTION__QNET_INJECTION, oldQNetInjection, qNetInjection));
			}
		}
		return qNetInjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ReactivePower basicGetQNetInjection() {
		return qNetInjection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setQNetInjection(ReactivePower newQNetInjection) {
		ReactivePower oldQNetInjection = qNetInjection;
		qNetInjection = newQNetInjection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, StateVariablesPackage.SV_INJECTION__QNET_INJECTION, oldQNetInjection, qNetInjection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case StateVariablesPackage.SV_INJECTION__PNET_INJECTION:
				if (resolve) return getPNetInjection();
				return basicGetPNetInjection();
			case StateVariablesPackage.SV_INJECTION__QNET_INJECTION:
				if (resolve) return getQNetInjection();
				return basicGetQNetInjection();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case StateVariablesPackage.SV_INJECTION__PNET_INJECTION:
				setPNetInjection((ActivePower)newValue);
				return;
			case StateVariablesPackage.SV_INJECTION__QNET_INJECTION:
				setQNetInjection((ReactivePower)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case StateVariablesPackage.SV_INJECTION__PNET_INJECTION:
				setPNetInjection((ActivePower)null);
				return;
			case StateVariablesPackage.SV_INJECTION__QNET_INJECTION:
				setQNetInjection((ReactivePower)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case StateVariablesPackage.SV_INJECTION__PNET_INJECTION:
				return pNetInjection != null;
			case StateVariablesPackage.SV_INJECTION__QNET_INJECTION:
				return qNetInjection != null;
		}
		return super.eIsSet(featureID);
	}

} //SvInjectionImpl
